﻿using System;

//Author: Morgan William Davis III
//Project: TRAC Ticket Manager v2
//Date: 14 Mar 2014

namespace TRACv2.Domain.Entities
{
    public class Employee
    {

        #region [ Fields ]

        private int _id;
        private int _personID;
        private string _firstName;
        private string _lastName;
        private int _positionID;
        private string _department;
        private DateTime _startDate;
        private DateTime _endDate;
        private string _code;

        #endregion

        #region [ Properties ]

        public int ID
        {
            get { return _id; }
            set
            {
                if (value > 0)
                    _id = value;
                else
                {
                    throw new ArgumentOutOfRangeException("value", "ID field must be greater than 1.");
                }
            }
        }

        public int PersonID
        {
            get { return _personID; }
            set
            {
                if (value > 0)
                    _personID = value;
                else
                {
                    throw new ArgumentOutOfRangeException("value", "PersonID field must be greater than 1.");
                }
            }
        }

        public string FirstName
        {
            get { return _firstName; }
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                    throw new ArgumentNullException(value, "First Name cannot be empty or null.");
                    _firstName = value;
            }
        }

        public string LastName
        {
            get { return _lastName; }
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                    throw new ArgumentNullException(value, "Last Name cannot be empty or null.");
                    _lastName = value;
                
            }
        }
        
        public int PositionID
        {
            get { return _positionID; }
            set
            {
                if (value > 0)
                    _positionID = value;
                else
                {
                    throw new ArgumentOutOfRangeException("value", "PositionID field must be greater than 1.");
                }
            }
        }

        public string Department
        {
            get { return _department; }
            set { _department = value; }
        }

        public DateTime StartDate
        {
            get { return _startDate; }
            set { _startDate = value; }
        }

        public DateTime EndDate
        {
            get { return _endDate; }
            set { _endDate = value; }
        }

        public string Code
        {
            get { return _code; }
            set
            {
                if(string.IsNullOrWhiteSpace(value))
                    throw new ArgumentNullException(value, "Employee Code cannot be empty or null.");
                    _code = value;
            }
        }

        #endregion

    }
}
